home *** CD-ROM | disk | FTP | other *** search
/ Your Choice 1 / your choice.zip / your choice / PRGMMING / MOUDESIG / MDESIGN.DOC < prev    next >
Text File  |  1993-04-20  |  40KB  |  1,009 lines

  1.       ╓ ╓ ─────────   ╓─╥ ───────────────────   ╓─╥ ──────────────────────────┐
  2.       ║ ║ N I T E D   ╟─╜ R O G R A M M E R S   ║   L U B        Feitelijke   │
  3.  ┌─── ╨─╜ ─────────   ╜ ─────────────────────   ╨─╜ ─────        Vereniging   │
  4.  │                                                                            │
  5.  │                                                                            │
  6.  │    Kent u de United Programmers Club ?                                     │
  7.  │                                                                            │
  8.  │    De United Programmers Club (kortweg UPC) is een vereniging voor  pro-   │
  9.  │    grammerende  gebruikers van IBM compatibele computers. Het  doel  van   │
  10.  │    de  UPC is programmeurs te ondersteunen en hulp te bieden, en hen  op   │
  11.  │    de hoogte te houden van de nieuwigheden op het vlak van programmeren.   │
  12.  │                                                                            │
  13.  │    Dit  alles is gebaseerd op uitwisselingen tussen de leden. Deze  uit-   │
  14.  │    wisselingen worden aangemoedigd door het houden van bijeenkomsten, en   │
  15.  │    door het uitgeven van een ledenblad. ┌──────────────────────────────╖   │
  16.  │    Daarnaast zorgt een boeken en  tijd- │   Voor info, schrijf naar:   ║   │
  17.  │    schriften  bibliotheek voor  naslag- │                              ║   │
  18.  │    werken. De softwarebibliotheek biedt │   UNITED PROGRAMMERS CLUB    ║   │
  19.  │    u programmeertools en compilers.     │   POSTBUS 40                 ║   │
  20.  │                                         │   B-1090 BRUSSELS            ║   │
  21.  │    Schrijf ons gerust om informatie !!! │   BELGIUM                    ║   │
  22.  │                                         ╘══════════════════════════════╝   │
  23.  └────────────────────────────────────────────────────────────────────────────┘
  24.  
  25.  
  26.  
  27.          ────────────────────────────────────────────────────────────────
  28.                         M O U S E   D E S I G N E R   1.0
  29.          ────────────────────────────────────────────────────────────────
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.                M O U S E   D E S I G N E R   v e r s i o n   1 . 0
  48.  
  49.                        (C) Copyright 1993 Rudi Breedenraedt
  50.  
  51.                                      FREEWARE
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74.          UNITED PROGRAMMERS CLUB
  75.          TAV. RUDI BREEDENRAEDT
  76.          POSTBUS 40
  77.          B-1090 BRUSSELS
  78.          BELGIUM                                              April 1993.
  79.  
  80.          ────────────────────────────────────────────────────────────────
  81.                        M O U S E   D E S I G N E R   1 . 0
  82.                                    M A N U A L
  83.          ────────────────────────────────────────────────────────────────
  84.  
  85.  
  86.                                  C O N T E N T S
  87.  
  88.  
  89.             1.        WHAT IS MOUSE DESIGNER ?                          2
  90.  
  91.             2.        SYSTEM REQUIREMENTS                               3
  92.  
  93.             3.        STARTING WITH MOUSE DESIGNER                      4
  94.             3.1       drawing mouse arrows                              4
  95.             3.2       testing the drawed mouse arrow                    4
  96.             3.3       loading mouse arrows from disk                    5
  97.             3.3.1       clearing the grid                               5
  98.             3.4       saving mouse arrows to disk                       5
  99.             3.4.1       the temporary file format                       6
  100.             3.4.2       *.TXT file format                               6
  101.             3.4.3       > PRN : redirect to printer                     6
  102.  
  103.             4.        COMMANDLINE OPTIONS                               7
  104.  
  105.             5.        ADVANCED FEATURES                                 8
  106.             5.1       mirror                                            8
  107.             5.2       turn 90°                                          8
  108.  
  109.             6.        USING MOUSE DESIGNER PROCEDURES                   9
  110.             6.1       in Quick-BASIC                                    9
  111.             6.2       in Turbo PASCAL                                  10
  112.             6.3       in C                                             10
  113.             6.4       in assembly                                      10
  114.             6.5       other programming languages                      11
  115.  
  116.             7.        DESCRIPTION OF FILE-FORMATS                      12
  117.             7.1       the *.MOU format                                 12
  118.             7.2       the *.COM format                                 12
  119.  
  120.             8.        MORE ABOUT...                                    14
  121.             8.1       using mouse control into your programs           14
  122.             8.2       defining graphical mouse arrow shapes            17
  123.  
  124.             9.        FREEWARE, SOURCECODE, UPGRADE, CONTACTING AUTHOR 19
  125.  
  126.             10.       THANKS TO...                                     20
  127.  
  128.  
  129.          ┌┤DISCLAIMER├──────────────────────────────────────────────────┐
  130.          │MOUSE DESIGN IS PROVIDED "AS IS", THIS MEANS THAT THE AUTHOR  │
  131.          │IS NOT RESPONSIBLE FOR EVENTUAL ERRORS (BUGS) IN THE PROGRAM. │
  132.          │IF YOU USE MOUSE DESIGN YOU AGREE WITH THIS RULE.             │
  133.          └──────────────────────────────────────────────────────────────┘
  134.  
  135.          Sorry, I know my English is awfull...
  136.  
  137.                                             MDESIGN 1.0   Manual  page 02
  138.          ────────────────────────────────────────────────────────────────
  139.  
  140.  
  141.  
  142.                                 C H A P T E R   1
  143.  
  144.  
  145.  
  146.   1.     WHAT IS MOUSE DESIGNER ?
  147.          ------------------------
  148.  
  149.          Mouse Designer is a programming tool for programmers in
  150.          Microsoft QuickBASIC 4.5+, Borland Turbo PASCAL 5.0+, Turbo C,
  151.          Microsoft Macro Assembler 6.0+,...
  152.  
  153.          Mouse Designer lets you design on an easy, interactive way
  154.          graphical mouse arrows for use in your own software. When saving
  155.          the mouse arrow, you can select different file formats:
  156.            - M_DESIGNER  (a special format for Mouse Designer)
  157.            - *.TXT       (a textual picture of the mouse arrow)
  158.            - *.BAS       (a QuickBASIC subroutine)
  159.            - *.PAS       (a Turbo Pascal unit)
  160.            - *.H         (a C header file)
  161.            - *.ASM       (a MASM procedure)
  162.            - *.COM       (a COM file to set the mouse arrow)
  163.            - > PRN   (redirect a textual picture of the mouse to printer)
  164.  
  165.          Note: mouse arrows can only be loaded from the M_DESIGN format.
  166.  
  167.          The Mouse Designer package contains MDESIGN.EXE (the main
  168.          program), some *.MOU example files, three QuickBASIC
  169.          demonstration programs (MDEMO1.BAS to MDEMO3.BAS) and a mouse
  170.          grabber (MGRAB.COM).
  171.  
  172.  
  173.                                             MDESIGN 1.0   Manual  page 03
  174.          ────────────────────────────────────────────────────────────────
  175.  
  176.  
  177.  
  178.                                 C H A P T E R   2
  179.  
  180.  
  181.  
  182.   2.     SYSTEM REQUIREMENTS
  183.          -------------------
  184.  
  185.          To use Mouse Designer you need - of course - a mouse and the
  186.          mouse driver MOUSE.COM or any equivalent mouse driver. You need
  187.          also a computer with at least 200K of free low memory. A VGA
  188.          color monitor is also required (EGA color monitors with more
  189.          than 64K memory will also suit).
  190.  
  191.  
  192.          Note: Many non-Microsoft-mouse-drivers (Logitech drivers, Agiler
  193.            drivers, Genius drivers,...) are not fully compatible with
  194.            Microsoft's MOUSE.COM. Mouse Designer works properly with
  195.            Microsoft's MOUSE.COM verion 7.03. If troubles occures using
  196.            the mouse, try another mouse driver.
  197.  
  198.  
  199.                                             MDESIGN 1.0   Manual  page 04
  200.          ────────────────────────────────────────────────────────────────
  201.  
  202.  
  203.  
  204.                                 C H A P T E R   3
  205.  
  206.  
  207.  
  208.   3.     STARTING WITH MOUSE DESIGNER
  209.          ----------------------------
  210.  
  211.          First you have to install MOUSE.COM.
  212.  
  213.          Then, just start MDESIGN.EXE from the DOS prompt. You will see a
  214.          screen with on the left side a grid wherein you can design your
  215.          own graphical mouse arrows. On the right side you will have some
  216.          boxes 'INPUT', 'OUTPUT', 'DEMO', etc. This are options you can
  217.          select by clicking with the mouse arrow on it. On the bottom you
  218.          will see 16 colored rectangles.
  219.  
  220.  
  221.   3.1.   DRAWING MOUSE ARROWS
  222.  
  223.          Ones MDESIGN.EXE is loaded, you cannot immediatly start drawing
  224.          mouse arrows in the grid using the mouse.
  225.  
  226.          You will first have to select in which 'color' you want to draw.
  227.          Indeed, the mouse graphic can have 4 different attributes:
  228.          white, black, background and inversed background. To select a
  229.          color, just pres F1, F2, F3 or F4. You can also select a color
  230.          by clicking the mouse in the middle box on the selected color.
  231.  
  232.          Ones a color is selected, you can draw using the left mouse
  233.          button to draw in the selected color, or the right mouse button
  234.          to draw in background color. (The middle mouse button is not
  235.          supported.)
  236.  
  237.  
  238.   3.2.   TESTING THE DRAWED MOUSE ARROW
  239.  
  240.          Ones you have designed an own mouse arrow, we suggest you should
  241.          test it on different backgrounds to see if the arrow is visible
  242.          on all those backgrounds. Click therefore with the mouse on the
  243.          'DEMO' box. The mouse arrow will now change into what you have
  244.          drawed. Go with the mouse arrow in the sixteen colored boxes on
  245.          the bottom of the screen to test them.
  246.  
  247.          To end the DEMO mode, press ESCape. The mouse arrow will now
  248.          return to its original form and you can continue drawing the
  249.          mouse arrow.
  250.  
  251.  
  252.                                             MDESIGN 1.0   Manual  page 05
  253.          ────────────────────────────────────────────────────────────────
  254.  
  255.  
  256.   3.3.   LOADING MOUSE ARROWS FROM DISK
  257.  
  258.          To load a mouse arrow from disk, click with the mouse on 'INPUT'
  259.          and the select a 'file format'. There are 3 file formats
  260.          available:
  261.            - TEMP        (temporary files, see 3.4.1)
  262.            - M_DESIGNER  (the standard file format)
  263.            - _CLEAR      (see: 3.3.1. CLEARING THE GRID)
  264.  
  265.          Select M_DESIGNER (by clicking twice on it) and type in the name
  266.          of the mouse arrow to load.
  267.  
  268.  
  269.   3.3.1. CLEARING THE GRID
  270.  
  271.          To clear the mouse arrow grod, just select 'INPUT' and '_CLEAR'
  272.          (clicking twice). The grid will now be cleared.
  273.  
  274.  
  275.   3.4.   SAVING MOUSE ARROWS TO DISK
  276.  
  277.          The designed mouse arrow can also be saved to different file
  278.          formats:
  279.            - TEMP        (temporary files, see 3.4.1)
  280.            - M_DESIGNER  (Mouse Designs standard file format)
  281.            - *.TXT       (a textual picture of the mouse arrow)
  282.            - *.BAS       (a QuickBASIC subroutine)
  283.            - *.PAS       (a Turbo Pascal unit)
  284.            - *.H         (a C header file)
  285.            - *.ASM       (a MASM procedure)
  286.            - *.COM       (a COM file to set the mouse arrow)
  287.            - > PRN   (redirect a textual picture of the mouse to printer)
  288.  
  289.          Fore how to use the created files in your own software, see the
  290.          chapter 'USING MOUSE DESIGNER PROCEDURES' (chapter 6).
  291.  
  292.          Note 1: save always your mouse arrows to the M_DESIGNER format,
  293.          it's the only way to reload them into Mouse Designer !
  294.  
  295.          Note 2: > PRN does not save a file, but sends a textual picture
  296.          of the mouse arrow to printer.
  297.  
  298.          Note 3: when typing a filename, you can only type in 8 chars for
  299.          the filename. The file will be saved in the active directory. Do
  300.          not  type  an extension, Mouse Designer automatically  adds  the
  301.          required extension to the filename.
  302.  
  303.  
  304.                                             MDESIGN 1.0   Manual  page 06
  305.          ────────────────────────────────────────────────────────────────
  306.  
  307.  
  308.   3.4.1. THE TEMPORARY FILE FORMAT
  309.  
  310.          When drawing the mouse arrow, you can regularly save the mouse
  311.          arrow to the file TEMP.MOU. Therefore, just select TEMP in the
  312.          'OUTPUT' menu. You don't have to type a filename. But note, that
  313.          everytime you saves a temporary file, the old TEMP.MOU is
  314.          erased, so be carefull !
  315.  
  316.          You can reload TEMP.MOU be selecting TEMP in the 'INPUT' menu.
  317.  
  318.  
  319.   3.4.2. *.TXT FILE FORMAT
  320.  
  321.          When selecting this fileformat, Mouse Designer will create a
  322.          file that contains a picture of the mouse arrow. You can browse
  323.          this picture from within DOS by typing:
  324.            TYPE name.TXT
  325.  
  326.  
  327.   3.4.3. > PRN : REDIRECT TO PRINTER
  328.  
  329.          Mouse Designer will send the same picture as it creates in a
  330.          *.TXT file format, to printer, with that exeption, that black
  331.          will become white and white black. The result will be a natural
  332.          mouse arrow picture on paper.
  333.  
  334.  
  335.                                             MDESIGN 1.0   Manual  page 07
  336.          ────────────────────────────────────────────────────────────────
  337.  
  338.  
  339.  
  340.                                 C H A P T E R   4
  341.  
  342.  
  343.  
  344.   4.     COMMANDLINE OPTIONS
  345.          -------------------
  346.  
  347.          MDESIGN.EXE accepts only two commandline options:
  348.            /?   (or /h /H) : displays help
  349.            filename        : loads a *.MOU file when starting
  350.  
  351.          So, the syntax of MDESIGN.EXE could be written as:
  352.  
  353.            MDESIGN [[drive:][path]filename[.MOU] | /?]
  354.  
  355.          Starting MDESIGN without commandline options will start up with
  356.          a blanco grid (grid in backgroundcolor).
  357.  
  358.          There should be some *.MOU files with this software. If you have
  359.          the file DEFAULT.MOU, try to start MDESIGN as:
  360.            MDESIGN default
  361.  
  362.          You will then start up with the default mouse arrow.
  363.  
  364.          [Please, do not modify the file DEFAULT.MOU]
  365.  
  366.  
  367.                                             MDESIGN 1.0   Manual  page 08
  368.          ────────────────────────────────────────────────────────────────
  369.  
  370.  
  371.  
  372.                                 C H A P T E R   5
  373.  
  374.  
  375.  
  376.   5.     ADVANCED FEATURES
  377.          -----------------
  378.  
  379.          Mouse Designer lets you draw your own graphical mouse arrows.
  380.          For the way to draw mouse arrows, see section 3.1.
  381.  
  382.          Mouse Designer provides also some features to help you drawing
  383.          mouse arrows. The first release of Mouse Designer counts only 2
  384.          advanced features, but I am planning some more for future
  385.          releases.
  386.  
  387.  
  388.   5.1.   MIRROR
  389.  
  390.          This options turns the graphical mouse arrow vertically, as if
  391.          you looked into a mirror on a wall.
  392.  
  393.  
  394.   5.2.   TURN 90°
  395.  
  396.          This option turns the graphic 90 degrees to the left (a clock
  397.          turns to the right).
  398.  
  399.  
  400.                                             MDESIGN 1.0   Manual  page 09
  401.          ────────────────────────────────────────────────────────────────
  402.  
  403.  
  404.  
  405.                                 C H A P T E R   6
  406.  
  407.  
  408.  
  409.   6.     USING MOUSE DESIGNER PROCEDURES
  410.          -------------------------------
  411.  
  412.          The procedures created by Mouse Designer are easy to integrate
  413.          in your software. In this chapter we will see how to do it.
  414.  
  415.          DON'T FORGET THAT THE MOUSE ARROW WILL ONLY GET A GRAPHICAL
  416.          SHAPE IF YOU WORK IN A GRAPHICAL VIDEOMODE.
  417.  
  418.  
  419.   6.1.   IN QUICK-BASIC
  420.  
  421.          Version: the created subroutines were tested under QuickBASIC
  422.          4.50, altough they should work in QuickBASIC 4.00 too. It will
  423.          not work under earlier versions of QuickBASIC, nor under
  424.          GW-BASIC, BASICA or QBASIC.
  425.  
  426.          MDESIGN creates a subroutine that you could load as module into
  427.          your programs or include manually using the cut and paste
  428.          options of the QuickBASIC environment into your main module.
  429.  
  430.            LOADING SUBROUTINE AS MODULE:
  431.            If you load the subroutine into your program as a module, you
  432.            should copy the line
  433.              DECLARE SUB MD.subname ()
  434.            to all modules that calls this subroutine.
  435.  
  436.          If you cut and paste the subroutine into your main module,
  437.          you have to type in your main module this one line:
  438.            '$INCLUDE: 'QB.BI'
  439.          ( │          └─────┴─ Yes, single quotes )
  440.          ( └── Yes, a remark-quote                )
  441.  
  442.          If the file QB.BI is not found, type following line on the DOS
  443.          prompt:
  444.            DIR \QB.BI /S
  445.          DOS will now tell you where the QB.BI file is situated (if any).
  446.          Maybe you will have to unpack QB.BI from the QuickBASIC
  447.          distribution disks. You can now modify the QuickBASIC evironment
  448.          by running QuickBASIC, then typing Alt+O and then pressing E:
  449.          the INCLUDE path should point to QB.BI.
  450.  
  451.          Finally, the procedure will only work if you started QuickBASIC
  452.          with the option /L, so:
  453.            QB /L
  454.  
  455.          If you link your program outside the QuickBASIC environment, you
  456.          should link QB.LIB with your program.
  457.  
  458.  
  459.                                             MDESIGN 1.0   Manual  page 10
  460.          ────────────────────────────────────────────────────────────────
  461.  
  462.  
  463.   6.2.   IN TURBO PASCAL
  464.  
  465.          Version: The Pascal units were tested under Turbo Pascal 5.0,
  466.          Turbo Pascal 6.0 and Turbo Pascal 7.0. I do not know if they
  467.          will work with lower versions of Turbo Pascal, nor if they will
  468.          work with other Pascal compilers. Just try it out.
  469.  
  470.          Using the created procedure in Turbo Pascal programs is quite
  471.          easy. Compile the file with the procedure without changing
  472.          anything to it to a TPU file (just compile the PAS file).
  473.  
  474.          In the beginning of your program, you will have to insert the
  475.          line
  476.            USES filename;
  477.          where filename is the name of the created *.PAS file (and the
  478.          TPU file).
  479.  
  480.          You can now call the procedure in your program without any
  481.          declaration beforehand.
  482.  
  483.  
  484.   6.3.   IN C
  485.  
  486.          Version: The C header files were tested under Turbo C. I presume
  487.          they will also work under Borland C/C++, but I don't think you
  488.          will be able to use them with Microsoft C/C++ or QuickC unless
  489.          you modify the header files...
  490.  
  491.          Using the header files in your C programs is very simple. Just
  492.          add in front of your program:
  493.            #include "name.h"
  494.  
  495.          You can now use freely the MD_NAME function (of type void) in
  496.          your program.
  497.  
  498.  
  499.   6.4.   IN ASSEMBLY
  500.  
  501.          Version: The assembly include files were tested under Microsoft
  502.          Macro Assembler 6.0.
  503.  
  504.          You could manually include the file into your program, or -
  505.          better - use the INCLUDE statement like this:
  506.            INCLUDE name.asm
  507.  
  508.          You can then call the procedure with:
  509.            call MDName
  510.  
  511.  
  512.                                             MDESIGN 1.0   Manual  page 11
  513.          ────────────────────────────────────────────────────────────────
  514.  
  515.  
  516.          The major problems you could encounter if you use another
  517.          assembler are the WORD and the PROC USES identifiers. You could
  518.          change them into:
  519.  
  520.                       WORD    0FFFFh, 0F87Ah,...
  521.  
  522.          into         DW      0FFFFh, 0F87Ah,...
  523.  
  524.          and
  525.  
  526.                MDName PROC USES AX BX CX DX ES
  527.                       ...
  528.                MDName ENDP
  529.  
  530.          into MDName  PROC
  531.                       PUSH AX
  532.                       PUSH BX
  533.                       PUSH CX
  534.                       PUSH DX
  535.                       PUSH ES
  536.                       ...
  537.                       POP ES
  538.                       POP DX
  539.                       POP CX
  540.                       POP BX
  541.                       POP AX
  542.               MDName  ENDP   ;(°)
  543.  
  544.          (°) some assemblers will need 'MDname ENDP', som others only
  545.          'ENDP'.
  546.  
  547.  
  548.   6.5.   OTHER PROGRAMMING LANGUAGES
  549.  
  550.          The easiest way to use Mouse Designer's arrows into other
  551.          programming languages, is to shell to COMMAND.COM and execute
  552.          the NAME.COM instruction (mouse arrow outputed to a COM file).
  553.          (Note that the NAME.COM files will only work in graphical mode,
  554.          the COM files do not change or set the graphical mode.)
  555.  
  556.          But that is certainly NOT the best way to do. The best you can
  557.          do, is to use files created for other languages (BASIC, PASCAL,
  558.          C,...) and modify them as needed.
  559.  
  560.          See paragraph 8.2 for more information about how to change the
  561.          mouse arrow in graphical mode.
  562.  
  563.          If you have to modify 'language-files', it could be usefull for
  564.          you to obtain the source code of Mouse Designer (if of course
  565.          you have QuickBASIC). See chapter 9 for more information about
  566.          this.
  567.  
  568.  
  569.                                             MDESIGN 1.0   Manual  page 12
  570.          ────────────────────────────────────────────────────────────────
  571.  
  572.  
  573.  
  574.                                 C H A P T E R   7
  575.  
  576.  
  577.  
  578.   7.     DESCRIPTION OF FILE-FORMATS
  579.          ---------------------------
  580.  
  581.   7.1.   THE *.MOU FORMAT
  582.  
  583.          Mouse Designer can only read files of the *.MOU format. Programs
  584.          that can create *.MOU files are Mouse Designer and MGRAB.COM.
  585.  
  586.          Every *.MOU file must be 68 bytes long. The file description is:
  587.  
  588.             byte  1    : X-axis of the hot spot (0-15)
  589.                   2    : 0 (MUST BE ZERO)
  590.                   3    : Y-axis of the hot spot (0-15)
  591.                   4    : 0 (MUST BE ZERO)
  592.                   5-36 : (32 bytes) screenmask
  593.                  37-68 : (32 bytes) cursormask
  594.  
  595.          Each mask (screen- and cursormask) is build up of 16 words
  596.          (unsigned integers of 2 bytes), every word corresponds to one
  597.          line of the arrow-picture (the first word represents the top
  598.          line, the last word the bottom line). The 8 pixels on the left-
  599.          hand side of the picture are represented by the 2nd byte (the
  600.          low byte) of the word, where the highest bit stands for the
  601.          pixel on the left.
  602.  
  603.          For more information about hot spot and screen- and cursormask,
  604.          see paragraph 8.2.
  605.  
  606.  
  607.   7.2.   THE *.COM FORMAT
  608.  
  609.          The COM file created by Mouse Designer corresponds to the
  610.          procedure-sourcecode generated for different programming
  611.          languages. So, the COM file only contains a routine to change
  612.          the shape of the mouse pointer.
  613.  
  614.          And since the shape of the mouse pointer can only be changed to
  615.          a graphical picture is the screen is in gaphical mode, executing
  616.          the COM file only makes sense if your screen is in a graphical
  617.          mode. You also have to show the mouse cursor yourselve.
  618.  
  619.          The results of the COM files are unpredictable if MOUSE.COM (are
  620.          any compatible mouse driver) is not installed !
  621.  
  622.  
  623.                                             MDESIGN 1.0   Manual  page 13
  624.          ────────────────────────────────────────────────────────────────
  625.  
  626.  
  627.          The COM file contains the following program:
  628.  
  629.            CODE   LABEL  MNEMONIC
  630.            0E            PUSH  CS
  631.            07            POP   ES            ;MOV ES,segment Shape
  632.            B80900        MOV   AX,0009h
  633.            BBxx00        MOV   BX,hot_spot_X ;a value between 00h and 0Fh
  634.            B9xx00        MOV   CX,hot_spot_Y ;a value between 00h and 0Fh
  635.            BAxxxx        MOV   DX,offset Shape
  636.            CD33          INT   33h
  637.            CD20          INT   20h
  638.            ...    Shape  DW    ...,...,...   ;32 bytes screenmask
  639.            ...           DW    ...,...,...   ;32 bytes cursormask
  640.  
  641.          For more information about hot spot and screen- and cursormask,
  642.          see paragraph 8.2.
  643.  
  644.  
  645.                                             MDESIGN 1.0   Manual  page 14
  646.          ────────────────────────────────────────────────────────────────
  647.  
  648.  
  649.  
  650.                                 C H A P T E R   8
  651.  
  652.  
  653.  
  654.   8.     MORE ABOUT...
  655.          -------------
  656.  
  657.  
  658.   8.1.   USING MOUSE CONTROL INTO YOUR PROGRAMS
  659.  
  660.          To use mouse control in your programs, MOUSE.COM (are any
  661.          equivalent mouse driver) must be loaded.
  662.  
  663.          You can check if MOUSE.COM is loaded with following statements:
  664.  
  665.            VARIABLE Buttons IS AN INTEGER  ;declare variable 'Buttons'
  666.            Reg.AX := 0000                  ;make register AX equal to 0
  667.            INTERRUPT 33h, Reg              ;call interrupt 33h
  668.            IF Reg.AX = FFFFh THEN
  669.               ;MOUSE.COM loaded and active, mouse present
  670.               IF Reg.BX = FFFFh THEN
  671.                  Buttons := 2
  672.               ELSE
  673.                  Buttons := Reg.BX
  674.               ENDIF
  675.            ELSE
  676.               ;MOUSE.COM not loaded or not active, or no mouse found
  677.               Buttons := 0
  678.            ENDIF
  679.  
  680.          (Note: calling interrupt 33h with AX=0000 resets the mouse
  681.           driver, this means that the mouse arrow will become invisible
  682.           and that the mousearrow will be able to move around the whole
  683.           screen (see further: functions 07h and 08h of interrupt 33h).)
  684.  
  685.          At the end of this small program, the variable Buttons will
  686.          indicate the number of buttons on the mouse. If Buttons=0 then
  687.          no mouse is connected, MOUSE.COM is not loaded or MOUSE.COM is
  688.          not active; in which case you should not try to execute the
  689.          other functions of interrupt 33h !
  690.  
  691.          If MOUSE.COM is active, you can use the other functions of
  692.          interrupt 33h. These are:
  693.  
  694.          FUNCTION 00H - RESET MOUSE DRIVER
  695.            Call:   AX = 0000
  696.            Return: AX : 0000 if mouse driver not active
  697.                         FFFF if mouse driver active
  698.                    BX : number of buttons (2 or 3)
  699.                         note: if BX = FFFF there are 2 buttons
  700.            This function tells you if the mouse driver is active and how
  701.            many mousebuttons there are. It also resets the mouse driver.
  702.  
  703.  
  704.                                             MDESIGN 1.0   Manual  page 15
  705.          ────────────────────────────────────────────────────────────────
  706.  
  707.  
  708.          FUNCTION 01H - SHOW MOUSE ARROW ON SCREEN
  709.            Call:   AX = 0001
  710.            Return: Nothing.
  711.            This function makes the mouse arrow visible on the screen.
  712.            See also: function 02h.
  713.  
  714.          FUNCTION 02H - HIDE MOUSE ARROW
  715.            Call:   AX = 0002
  716.            Return: Nothing.
  717.            This function is the inverse of function 01H: it hides the
  718.            mouse arrow. You should hide the mouse arrow every time you
  719.            write something on the screen (under the mouse arrow).
  720.            Note: Multiple calls of this function will require multiple
  721.                  calls of function 01h to make the mouse arrow visible
  722.                  again.
  723.            See also: function 01h.
  724.  
  725.          FUNCTION 03H - GET ACTUAL MOUSE STATUS
  726.            Call:   AX = 0003
  727.            Return: BX : buttonstatus:
  728.                           bit 0 : 1/0 left button pressed/released
  729.                           bit 1 : 1/0 right button pressed/released
  730.                           bit 2 : 1/0 middle button pressed/released
  731.                    CX : X-position of mouse arrow
  732.                    DX : Y-position of mouse arrow
  733.            This function returns the actual position of the mouse arrow
  734.            and the actual state of the mouse buttons.
  735.            Note: The X- and Y-positions does not always match the screen
  736.              coordinates. See important notice below !
  737.            See also: function 04h, 05h, 06h.
  738.  
  739.          FUNCTION 04H - POSITION THE MOUSE ARROW
  740.            Call:   AX = 0004
  741.                    CX : X-position of mouse arrow
  742.                    DX : Y-position of mouse arrow
  743.            Return: Nothing.
  744.            This function moves the mouse arrow to (CX,DX).
  745.            Note: The X- and Y-positions does not always match the screen
  746.              coordinates. See important notice below !
  747.            See also: function 04h.
  748.  
  749.          FUNCTION 05H - GET STATUS LAST TIME PRESSED
  750.            Call:   AX = 0005
  751.                    BX : buttonnumber:
  752.                         0 = left button
  753.                         1 = right button
  754.                         2 = middle button
  755.            Return: AX : actual buttonstatus (see function 03h)
  756.                    BX : number of times specified key was pressed since
  757.                         this function was last called
  758.                    CX : X-position when specified button was last pressed
  759.                    DX : Y-position when specified button was last pressed
  760.            This function returns the number of times button BX was
  761.            pressed since this function was last called. It also returns
  762.            the position (CX,DX) where the mouse arrow stood when the
  763.            mouse button BX was last pressed.
  764.            See also: function 03h, 06h.
  765.  
  766.  
  767.                                             MDESIGN 1.0   Manual  page 16
  768.          ────────────────────────────────────────────────────────────────
  769.  
  770.  
  771.          FUNCTION 06H - GET STATUS LAST TIME RELEASED
  772.            Call:   AX = 0006
  773.                    BX : buttonnumber:
  774.                         0 = left button
  775.                         1 = right button
  776.                         2 = middle button
  777.            Return: AX : actual buttonstatus (see function 03h)
  778.                    BX : number of times specified key was released since
  779.                         this function was last called
  780.                    CX : X-position when specified button was last
  781.                         released
  782.                    DX : Y-position when specified button was last
  783.                         released
  784.            This function returns the number of times button BX was
  785.            released since this function was last called. It also returns
  786.            the position (CX,DX) where the mouse arrow stood when the
  787.            mouse button BX was last released.
  788.            See also: function 03h, 05h.
  789.  
  790.          FUNCTION 07H - SET HORIZONTAL LIMITS
  791.            Call:   AX = 0007
  792.                    CX : Leftside limit
  793.                    DX : Rightside limit
  794.            Return: Nothing.
  795.            With this function, you can set horizontal limits to the
  796.            movement of the mouse arrow. When this function is called, the
  797.            mouse arrow can only be moved between column CX and DX.
  798.            Note: The X- and Y-positions does not always match the screen
  799.              coordinates. See important notice below !
  800.            See also: function 08h.
  801.  
  802.          FUNCTION 08H - SET VERTICAL LIMITS
  803.            Call:   AX = 0008
  804.                    CX : Upper limit
  805.                    DX : Lower limit
  806.            Return: Nothing.
  807.            With this function, you can set vertical limits to the
  808.            movement of the mouse arrow. When this function is called, the
  809.            mouse arrow can only be moved between row CX and DX.
  810.            Note: The X- and Y-positions does not always match the screen
  811.              coordinates. See important notice below !
  812.            See also: function 07h.
  813.  
  814.          FUNCTION 09H - DEFINE SHAPE OF GRAPHICAL MOUSE ARROW
  815.            Call:   AX = 0009
  816.                    BX : column of hot spot (0-15)
  817.                    CX : row of hot spot (0-15)
  818.                    ES:DX : pointer to table with screenmask and cursor-
  819.                         mask (2 * 32 bytes)
  820.            Return: Nothing.
  821.            This function lets you redefine the shape of the graphical
  822.            mouse arrow.
  823.            See also: function 0Ah, paragraph 8.2 of this manual.
  824.  
  825.  
  826.                                             MDESIGN 1.0   Manual  page 17
  827.          ────────────────────────────────────────────────────────────────
  828.  
  829.  
  830.          FUNCTION 0AH - DEFINE SHAPE OF TEXTMODE MOUSE ARROW
  831.            Call:   AX = 000A
  832.                    BX : 0000 for software mouse arrow:
  833.                           CH : screenmask attribute
  834.                           CL : screenmask character
  835.                           DH : cursormask attribute
  836.                           DL : cursormask character
  837.                         0001 for hardware mouse arrow:
  838.                           CX : start scan line
  839.                           DX : end scan line
  840.            Return: Nothing.
  841.            This function lets you redifine the shape of the mouse arrow
  842.            in text mode.
  843.            See also: function 09h.
  844.  
  845.          ...
  846.          (There are many more functions of interrupt 33h, but those above
  847.           are the most used, and are enough to write mouse controlled
  848.           programs.)
  849.  
  850.          IMPORTANT NOTICE ON MOUSE COORDINATES:
  851.           When the mouse driver asks or returns screen coordinates (x and
  852.           y-axis), mostly registers CX and DX are used: CX for the x-axis
  853.           coordinate, DX for the y-axis coordinate.
  854.           These coordinates are always expressed in pixels, even when the
  855.           video display is in text mode !
  856.           For text modes, the coordinates are expressed as for a
  857.           (640x200) screen resolution (for 40x25 or 80x25 textmodes). So,
  858.           if X and Y are screen coordinates, you can switch between
  859.           screen coordinates and mouse coordinates with both following
  860.           formules:     X = 1 + (CX / a)
  861.                     and Y = 1 + (DX / 8)
  862.           (where a=8 for 80 column modes and a=16 for 40 column modes).
  863.           Both formules above are valid for text modes with 25, 43 50 or
  864.           60 lines.
  865.           In graphical modes, the mouse coordinates matches the screen
  866.           coordinates, except in all (320x200) screen resolution modes,
  867.           where you can use following tranformationformules:
  868.                         X = CX / 2
  869.                         Y = DX
  870.  
  871.  
  872.   8.2.   DEFINING GRAPHICAL MOUSE ARROW SHAPES
  873.  
  874.          Standard, the mouse arrow is - in graphical video modes - an
  875.          arrow pointing to left-up. This arrow fits in a box of 16 pixels
  876.          on 16 pixels on the screen. When we use function 09h of
  877.          interrupt 33h to redifine the mouse arrow shape (what we are
  878.          doing), we are also limited to a 16 pixels on 16 pixels lage
  879.          arrow. (Recent software mostly uses another function of
  880.          interrupt 33h so they can get larger mouse arrows.)
  881.  
  882.  
  883.                                             MDESIGN 1.0   Manual  page 18
  884.          ────────────────────────────────────────────────────────────────
  885.  
  886.  
  887.          Colored graphical mouse arrows are not (yet) supported by the
  888.          mouse driver, so we should have to rewrite some functions of the
  889.          mouse driver to use colored mouse arrows. We won't do that here.
  890.  
  891.          To define a shape for the graphical mouse arrow, we use two
  892.          'masks': a screenmask and a cursormask. Each mask contains 16x16
  893.          pixels of information (so each mask is 32 bytes long). Because -
  894.          using two masks - every pixel of the mouse arrow is defined by
  895.          two bits in the masks (one in each mask), you could speak about
  896.          4 attributes.
  897.  
  898.          When drawing the mouse arrow on the screen, the mouse driver
  899.          will AND the pixels on the screen with the screenmask, and then
  900.          XOR the result with the cursormask. So:
  901.  
  902.             ((PIXEL AND SCREENMASK) XOR CURSORMASK) = NEW PIXEL
  903.  
  904.          Where PIXEL is the color of the pixel under the mouse arrow, and
  905.          NEW PIXEL is the color of that pixel of the mouse arrow, ones
  906.          the mouse arrow is drawed on the screen.
  907.  
  908.          Lets use a diagram to show how the screen- and cursormask work:
  909.  
  910.             PIXEL and SCREENMASK xor CURSORMASK = NEW PIXEL
  911.              any           0              0        black
  912.              any           0              1        white
  913.              any           1              0        background color
  914.              any           1              1        inversed backgr.color
  915.  
  916.          So, if all bits of both masks are 0, the mouse arrow will be a
  917.          black box of 16 pixels on 16 pixels...
  918.  
  919.          When calling function 09h of interrupt 33h, ES:DX must point to
  920.          an area of 64 bytes, where the 32 first bytes are the screenmask
  921.          and the 32 last bytes the cursormask.
  922.          Registers BX and CX should contain the coordinates of the hot
  923.          spot of the arrow, relative to the 16x16 pixels arrow. So, to
  924.          indicate the most left-up pixel of the mouse arrow, BX and CX
  925.          should both contain 0; to indicate the most right-bottom pixel
  926.          as hot spot, BX and CX should both contain the value 15.
  927.  
  928.          When executing function 09h of interrupt 33h, the mouse driver
  929.          will make a copy of both masks into a buffer of the mouse
  930.          driver. So changing the masks ones the function is executed,
  931.          will not affect the mouse arrow on the screen.
  932.  
  933.  
  934.                                             MDESIGN 1.0   Manual  page 19
  935.          ────────────────────────────────────────────────────────────────
  936.  
  937.  
  938.  
  939.                                 C H A P T E R   9
  940.  
  941.  
  942.  
  943.   9.     FREEWARE - SOURCECODE - UPGRADE - CONTACTING THE AUTHOR
  944.          -------------------------------------------------------
  945.  
  946.          Mouse Designer is 'freeware'. This means you may freely use,
  947.          copy and distribute Mouse Designer, at 3 conditions:
  948.  
  949.            1. you may not modify Mouse Designer or any of its
  950.               accompanying files,
  951.            2. you may only distribute Mouse Designer or any of its
  952.               accompanying files if you distribute all files of the
  953.               Mouse Designer package together,
  954.            3. you may not ask a fee to exceed $10 for distribution, post
  955.               and package.
  956.  
  957.          Although you may use and copy Mouse Designer freely, you are
  958.          encouraged to send a fee to the author if you use it. You may
  959.          send me any fee you want, but if you send me at least US$ 15 (°)
  960.          you will get the copyrighted sourcecode of MDESIGN.EXE (written
  961.          in QuickBASIC 4.50) and MGRAB.COM (written in Microsoft Macro
  962.          Assembler 6.0) and also a free upgrade of Mouse Designer when
  963.          it's available.
  964.  
  965.          The sourcecodes of MDESIGN.EXE and MGRAB.COM are NOT freeware.
  966.          These sourcecodes may NOT be distributed !
  967.  
  968.          (°) or 400 BEF (Belgium & Luxembourg), ƒ 25.- (The Netherlands),
  969.          80 FF (France), 25 DM (Germany), £ 9.- (Great Britain), 12 ECU.
  970.  
  971.          You could send me your fee be (international) mail order (ask
  972.          your post office), (from European countries) by EuroCheque or by
  973.          any other way you like.
  974.  
  975.  
  976.          You can contact the author only by mail, by writing to:
  977.            UNITED PROGRAMMERS CLUB
  978.            TAV.RUDI BREEDENRAEDT
  979.            POSTBUS 40
  980.            B-1090 BRUSSELS
  981.            BELGIUM
  982.  
  983.          You may write me for any problem you have using Mouse Designer,
  984.          for idea's to ameliorate it, to tell me about bugs you found, or
  985.          for any thing else you like...
  986.  
  987.  
  988.                                             MDESIGN 1.0   Manual  page 20
  989.          ────────────────────────────────────────────────────────────────
  990.  
  991.  
  992.  
  993.                                C H A P T E R   1 0
  994.  
  995.  
  996.  
  997.   10.    THANKS TO...
  998.          ------------
  999.  
  1000.          Thanks to:
  1001.            - Microsoft, for providing a friendly QuickBASIC compiler and
  1002.              a powerfull Macro Assembler,
  1003.            - Michel Brackx and Wim Vandersmissen for beta-testing and
  1004.              helping creating the 'foreign'-language procedures,
  1005.  
  1006.  
  1007.  
  1008.          Product names are (registered) trademarks of their producers.
  1009.